class MyCircularQueue {
    private int[] queue;
    private int front;
    private int rear;

    public MyCircularQueue(int k) {
        this.queue = new int[k + 1];
    }

    public boolean enQueue(int value) {
        if(isFull()) return false;
        this.queue[this.rear] = value;
        this.rear = (this.rear + 1) % this.queue.length;
        return true;
    }

    public boolean deQueue() {
        if(isEmpty()) return false;
        this.front = (this.front + 1) % this.queue.length;
        return true;
    }

    public int Front() {
        if(isEmpty()) return -1;
        return this.queue[this.front];
    }

    public int Rear() {
        if(isEmpty()) return -1;
        return this.queue[(rear - 1 + this.queue.length) % this.queue.length];
    }

    public boolean isEmpty() {
        if(this.rear == this.front) {
            return true;
        }
        return false;
    }

    public boolean isFull() {
        if((this.rear + 1) % this.queue.length == this.front) {
            return true;
        }
        return false;
    }
}